home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / Hack / MISC / MAGCARD1.ZIP / MAGCARD1.TXT < prev   
Encoding:
Internet Message Format  |  1993-06-03  |  13.1 KB

  1. From: brian@ucsd.edu (Brian Kantor)
  2. Newsgroups: sci.electronics
  3. Subject: Re: Encoding Scheme of Mag Stripe Cards?
  4. Date: 10 Jan 92 20:58:00 GMT
  5. Organization: The Avant-Garde of the Now, Ltd.
  6.  
  7. e142-aq@hercules.Berkeley.EDU (Alan Nishioka) writes:
  8.  
  9. >Does anybody know how information is encoded on the magnetic stripe for
  10. >credit cards, bank cards, my student id, etc.?  Any references?  A trip
  11. >to the library and looking thru the reader 's guide didn't get me anywhere.
  12.  
  13. Well, there's three tracks (ISO 3554), all 0.110" wide. The top one is
  14. 210 BPI and has 7 bits per chr. (incl. parity). Total 79 alpha-num. chrs.
  15. The second track has 75 BPI, 5 bits per chr. (incl. par.) total 40 digits
  16. The third track has agian 210 BPI, 5 bits per chr (yeah incl. par.) total
  17. 107 digits.
  18.  
  19. Data is coded reversing the polarity of the magnetic field once or twice in
  20. the field for that bit. Since you cannot double of half the speed of the card
  21. within the space for 1 bit, it all works.
  22.  
  23. >I just bought a card reader which had 5 ttl level outputs.  Two for each
  24. >of 2 head tracks and a 5th that goes low when a card is being run thru.
  25. >The chips don't seem to be identifiable.
  26.  
  27. Well, the bad news is that you'll have to write the decoding software yourself.
  28. Not much to it, I did it on a Commodore-64. Our magazine ("Hack-Tic") printed
  29. the full specs on all this in the last issue.
  30. -- 
  31. Rop Gonggrijp (ropg@ooc.uva.nl) is also editor of  Hack-Tic (hack/phreak mag.)
  32. quote: "We don't care about freedom of the mind, | Postbus 22953    (in DUTCH)
  33.         freedom of signature will do just fine"  | 1100 DL  AMSTERDAM
  34. Any opinions in this posting are wasted on you   | tel: +31 20 6001480
  35.  
  36.  
  37.  
  38. > Article <28174@pasteur.Berkeley.EDU> From: e142-aq@hercules.Berkeley.EDU
  39. > (Alan Nishioka)
  40. >Does anybody know how information is encoded on the magnetic stripe for
  41. >credit cards, bank cards, my student id, etc.?  Any references?  A trip
  42. >to the library and looking thru the reader 's guide didn't get me anywhere.
  43.  
  44. You'll want to see the American National Standard X4.16 (which I
  45. just happen to have sitting in my lap.)  It is available from the
  46.  
  47.     American National Standards Institute, Inc.
  48.     1430 Broadway
  49.     New York, NY  10018
  50.  
  51. My version is dated 1983.  I suspect it has been superceded by now.
  52. It details everything (everything!) you ever could possibly want to
  53. know about mag stripe encoding for financial services cards.
  54.  
  55. >I just bought a card reader which had 5 ttl level outputs.  Two for each
  56. >of 2 head tracks and a 5th that goes low when a card is being run thru.
  57. >The chips don't seem to be identifiable.
  58.  
  59. In most all of the MSR's I've taken apart, the chips are custom.
  60. One of our vendor's configurations for the wiring looked like this:
  61.  
  62.     1    RDT1    Data from track 1
  63.     2    RCL1    Clock from track 1
  64.     3    GND
  65.     4    +5V
  66.     5    n/c
  67.     6    RCL2    Clock from track 2
  68.     7    CLD    Card Presence
  69.     8    RDT2    Data from track 2
  70.  
  71. You could use a scope to determine which is which -- track 2 is recorded
  72. at 75 bits/inch while track 1 is 210 bits/inch.  Just watch the blinking!
  73. The data is self clocking.
  74.  
  75.       _____       __    __    _____    __
  76.      |     |_____|  |__|  |__|     |__|  |_____
  77.      ^     ^     ^     ^     ^     ^     ^
  78.         0     0     1     1     0     1     0
  79.  
  80. >I discovered that cards seem to use two different levels of stripe, for
  81. >a total of 4 tracks on my bank card, but only two on my student id, which
  82. >are at the wrong level for my reader.
  83.  
  84. Your bank card will typically only use the read-only tracks one and two.
  85. Track 3 is a read/write track that has the same electromagnetic properties
  86. as track 1, but its usage is not standardized within the industry.  Many
  87. cards issued today do not even have magnetic media at the location for
  88. track 3.  (It was originally intended for off-line ATM authorization,
  89. but guess what happened to that idea!)
  90.  
  91. >The code must be self-clocking and I would guess just have simple 
  92. >error checking (parity) since the card can just be run thru again if
  93. >necessary.
  94.  
  95. The parity checking is pretty impressive.  Track 1 characters are 6
  96. bits plus one (odd) parity bit.  There is also an LRC (Longitudinal
  97. Redundancy Check) character after the end sentinel character.  The
  98. LRC bits are parity bits for all the characters in the track such
  99. that the total one bits are odd.  (The LRC parity bit is simply a
  100. parity check on the LRC character.)  This scheme protects against
  101. almost all random card damage, as you would have to have four bits
  102. wrong (the corners of a rectangle, physically) to escape detection.
  103. Track 2 parity detection is the same, but track 2 characters are
  104. only 4 bits plus one (odd) parity bit.
  105.  
  106. The character sets are fairly simple subsets of ASCII.  Tracks 1 & 3
  107. use this table:
  108.  
  109.         0    1    2    3
  110.             00    01    10    11 <-MSD
  111.  
  112.      0    0000    SP    0    @a    P
  113.      1    0001    !a    1    A    Q
  114.      2    0010    "a    2    B    R
  115.      3    0011    #b    3    C    S
  116.      4    0100    $    4    D    T
  117.      5    0101    %c    5    E    U
  118.      6    0110    &a    6    F    V
  119.      7    0111    'a    7    G    W
  120.      8    1000    (    8    H    X
  121.      9    1001    )    9    I    Y
  122.      A    1010    *a    :a    J    Z
  123.      B    1011    +a    ;a    K    [d
  124.      C    1100    ,a    <a    L    \d
  125.      D    1101    -    =a    M    ]d
  126.      E    1110    .    >a    N    ^c
  127.      F    1111    /    ?c    O    _d
  128.  
  129.      a    For the encoding of data on magnetic stripe cards, these
  130.     character positions shall not contain information characters
  131.     (data content).
  132.  
  133.      b    Optional additional graphic.
  134.  
  135.      c    These characters shall have the following meaning for this application:
  136.     25  %  represents start sentinel.
  137.     3F  ?  represents end sentinel.
  138.     5E  ^  represents separator.
  139.  
  140.      d    These character positions are reserved for additional national
  141.     characters when required.  They shall not be used internationally.
  142.  
  143.  
  144. Track 1 format:
  145.  
  146. Format A.  Reserved for proprietary use of card issuer.
  147.  
  148. Format B.
  149. Start sentinel        1 character
  150. Format code = "B"    1 character - alpha only
  151. Primary Account Number    Up to 19 characters (Note 1)
  152. Separator        1 character
  153. Country code        3 characters (Note 2)
  154. Name            2-26 characters (note 3)
  155.   Surname
  156.   Surname separator="/"
  157.   First name or initial
  158.   Space (when required) (Note 4)
  159.   Middle name or initial
  160.   Period (when followed by title)
  161.   Title (when used)
  162. Separator        1 character
  163. Expiration date or    4 characters or 1 character
  164.   separator        (Note 5)
  165. Discretionary data    The balance to maximum record length
  166. End sentinel        1 character
  167. LRC            1 character (see above for LRC calculation)
  168. Total            79 characters max.
  169.  
  170. Notes:
  171.      1    In accordance with the account numbering scheme in ANSI X4.13-1983.
  172.      2    When the primary account number commences with major industry
  173.     identifier "5" followed by "9", the encoding of the country
  174.     in this position is mandatory.  In all other situations, the
  175.     expiration date or separator shall immediately follow the
  176.     separator that terminates the primary account number.  The
  177.     country code for the United States is 840.
  178.      3    The absolute minimum data encoded in the name field will be
  179.     a single alpha character in the surname area and the surname
  180.     separator (/).
  181.      4    The space character is required to separate the logical elements
  182.     of the name field other than the surname.  The separator terminating
  183.     the name field should be encoded following the last logical element
  184.     of the name field.  If only the surname is encoded, it will follow
  185.     the surname separator.
  186.      5    In accordance with ANSI X3.30-1971.  If no expiration date is
  187.     associated with the card, a separator shall be encoded.  The
  188.     format for the expiration date is YYMM.
  189.  
  190. Format Codes C through M.  The format codes are reserved for use by
  191. ANSI Subcommittee X3B10 in connection with other data formats of track 1.
  192.  
  193. Format Codes N through Z.  Available for use by individual card issuers.
  194.  
  195.  
  196. Track 2 uses the following 4 bit character set:
  197.  
  198.      0    0000    0
  199.      1    0001    1
  200.      2    0010    2
  201.      3    0011    3
  202.      4    0100    4
  203.      5    0101    5
  204.      6    0110    6
  205.      7    0111    7
  206.      8    1000    8
  207.      9    1001    9
  208.      A    1010    Note 1
  209.      B    1011    Start sentinel (start character)
  210.      C    1100    Note 2
  211.      D    1101    Separator
  212.      E    1110    Note 1
  213.      F    1111    End sentinel (stop character)
  214.  
  215. Notes:
  216.      1    These characters are available for hardware control purposes
  217.     and shall not be used for data content.
  218.  
  219.      2    This character is reserved for future definition in connection
  220.     with the data format on track 2.
  221.  
  222. Track 2 format:
  223.  
  224. Start sentinel        1 character
  225. Primary Account Number    Up to 19 characters (Note 1)
  226. Separator        1 character
  227. Country code        3 characters (Note 2)
  228. Expiration date or    4 characters or 1 character
  229.   separator        (Note 3)
  230. Discretionary data    The balance to maximum record length
  231. End sentinel        1 character
  232. LRC            1 character (see above for LRC calculation)
  233. Total            40 characters max.
  234.  
  235. Notes:
  236.      1    In accordance with the account numbering scheme in ANSI X4.13-1983.
  237.      2    When the primary account number commences with major industry
  238.     identifier "5" followed by "9", the encoding of the country
  239.     in this position is mandatory.  In all other situations, the
  240.     expiration date or separator shall immediately follow the
  241.     separator that terminates the primary account number.  The
  242.     country code for the United States is 840.
  243.      3    In accordance with ANSI X3.30-1971.  If no expiration date is
  244.     associated with the card, a separator shall be encoded.  The
  245.     format for the expiration date is YYMM.
  246.  
  247. >BTW, I just want to read, not commit bank fraud :-)  I would have to build
  248. >another card input/output assembly for that :-)
  249.  
  250. I've seen some scams based on ATM card fraud, but it may be tough to
  251. fool Mother Visa...particularily when you have to hand your card to
  252. a living, breathing human.
  253.  
  254. Do me a favor and mail me a copy of your interface circuit when you
  255. get it working, OK?
  256.  
  257. -j, now you know all our little secrets, eh?
  258. -- 
  259. J. Deters                            Ask me about my PS/2.        //
  260. INTERNET:  jad@dayton.DHDSC.MN.ORG   Then,                       //
  261. UUCP:  ...!bungia!dayton!jad         ask me about my Amiga!  \\ //
  262. ICBM:  44^58'36"N by 93^16'12"W                               \X/
  263.  
  264.  
  265.  
  266.  
  267. Just got my new California driver's license.  No, I'm not 17, but I take the
  268. bus a lot.
  269.  
  270. It has a holographic plastic laminate of "DMV" and the California Seal.
  271.  
  272. My color picture was digitized into and IBM computer as was my thumb print
  273. and my signature.  The mag stripe on the back has three tracks.
  274.  
  275. Just for fun, I thought I'd try to read it.  I had previously been able
  276. to read bank cards (with help from sci.electronics).  I found that the
  277. information encoded is basically just what is printed on the card.  Kinda
  278. uninteresting.  Of course I couldn't figure out what little extra information
  279. was encoded.... (marked unidentified below)
  280.  
  281. It took me a little while to figure out the format, and I suppose it is
  282. documented somewhere (anyone know where?) but it was fun.
  283.  
  284. Bank Cards -- conform to ANSI/ISO 7810-1985 ($10)
  285. Track 1:    6 bit word with 1 bit parity.  LSB first.
  286.             code offset 32 below ASCII code.
  287. Track 2:    4 bit word with 1 bit parity.  LSB first.  Numbers only.
  288.  
  289. Driver's License --
  290. Track 1:    6 bit word with no parity.  Otherwise same as Bank Card.
  291. Track 2:    Same as Bank Card.
  292.  
  293. California Driver's License:
  294. ---------------------------
  295. Track 2:    (low density)
  296.     8 unidentified digits
  297.     License Number
  298.     Separator
  299.     Expiration Date (YYMM)
  300.     Separator
  301.     Date of Birth (YYYYMMDD)
  302.  
  303. Track 1:    (High density)
  304. DALAN TAKEO NISHIOKA                                       $
  305. 974 TULARE AVE               ALBANY       
  306.     Name (58 characters)
  307.     Address (29 characters)
  308.     City (13 characters)
  309.  
  310. Track 3:    (High density.  Can't reposition read head. );
  311.  
  312. Great Western Bank ATM Card:
  313. ---------------------------
  314. Track 2:
  315.     Account number on the front of the card
  316.     Separator
  317.     Expiration date (no country code)
  318.     Other (propietary) data
  319.  
  320. Track 1:
  321.     Format B
  322.     Account number
  323.     Separator
  324.     Name (from front of card)
  325.     Separator
  326.     Expiration date (no country code)
  327.     Other data
  328.  
  329. AT&T Universal Card:
  330. -------------------
  331. Track 1:
  332.     Format B
  333.     Account Number
  334.     Separator
  335.     Name
  336.     Separator
  337.     Expiration Date (YYMM)
  338.     6 Unknown chars
  339.     Calling Card Number (10 digits)
  340.  
  341. Track 2:
  342.     Account Number
  343.     Separator
  344.     Expiration Date (YYMM)
  345.     3 Unknown chars
  346.  
  347. Citibank ATM Card:
  348. -----------------
  349. Track 1:
  350.     Format A (proprietary)
  351.     Name
  352.     Separator
  353.     Account Number
  354.     Separator
  355.     Expiration Date (MMYY)
  356.     7 Unidentified chars 
  357.  
  358. Track 2:
  359.     Account Number
  360.     Separator
  361.     Expiration Date (MMYY)
  362.     7 Unidentified chars
  363.  
  364. -----------------------------------------------------------------------------
  365. Alan Nishioka      KC6KHV      atn@cory.berkeley.edu      ...!ucbvax!cory!atn
  366. 974 Tulare Avenue, Albany CA 94707-2540     37'52N/122'15W    +1 415 526 1818
  367.  
  368.  
  369.                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  370.                 d  a  t  a       c  o  n  t  r  o  l       I.             
  371.                 c o n t r o l         t e a m         u s h q 
  372.                 t e l c o ' s     s h a k e    i n    f e a r
  373.                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  374. < Advertisment added using -=Bad Ad=- 1.91 by Troed/Sync. BBS: +46-451-91002 >
  375.